package com.ruoyi.cmdb.service.impl;

import java.util.List;

import com.ruoyi.cmdb.util.GetId;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cmdb.mapper.ServiceMasterTypeMapper;
import com.ruoyi.cmdb.domain.ServiceMasterType;
import com.ruoyi.cmdb.service.IServiceMasterTypeService;

/**
 * 服务宿主类型Service业务层处理
 *
 * @author ruoyi
 * @date 2023-01-28
 */
@Service
public class ServiceMasterTypeServiceImpl implements IServiceMasterTypeService
{
    GetId getId=new GetId();//用这个类的方法生成当前时间的id
    @Autowired
    private ServiceMasterTypeMapper serviceMasterTypeMapper;

    /**
     * 查询服务宿主类型
     *
     * @param id 服务宿主类型主键
     * @return 服务宿主类型
     */
    @Override
    public ServiceMasterType selectServiceMasterTypeById(String id)
    {
        return serviceMasterTypeMapper.selectServiceMasterTypeById(id);
    }

    /**
     * 查询服务宿主类型列表
     *
     * @param serviceMasterType 服务宿主类型
     * @return 服务宿主类型
     */
    @Override
    public List<ServiceMasterType> selectServiceMasterTypeList(ServiceMasterType serviceMasterType)
    {
        return serviceMasterTypeMapper.selectServiceMasterTypeList(serviceMasterType);
    }

    /**
     * 新增服务宿主类型
     *
     * @param serviceMasterType 服务宿主类型
     * @return 结果
     */
    @Override
    public int insertServiceMasterType(ServiceMasterType serviceMasterType)
    {
        serviceMasterType.setId(getId.getTimeId());
        serviceMasterType.setCreateTime(DateUtils.getNowDate());
        return serviceMasterTypeMapper.insertServiceMasterType(serviceMasterType);
    }

    /**
     * 修改服务宿主类型
     *
     * @param serviceMasterType 服务宿主类型
     * @return 结果
     */
    @Override
    public int updateServiceMasterType(ServiceMasterType serviceMasterType)
    {
        serviceMasterType.setUpdateTime(DateUtils.getNowDate());
        return serviceMasterTypeMapper.updateServiceMasterType(serviceMasterType);
    }

    /**
     * 批量删除服务宿主类型
     *
     * @param ids 需要删除的服务宿主类型主键
     * @return 结果
     */
    @Override
    public int deleteServiceMasterTypeByIds(String[] ids)
    {
        return serviceMasterTypeMapper.deleteServiceMasterTypeByIds(ids);
    }

    /**
     * 删除服务宿主类型信息
     *
     * @param id 服务宿主类型主键
     * @return 结果
     */
    @Override
    public int deleteServiceMasterTypeById(String id)
    {
        return serviceMasterTypeMapper.deleteServiceMasterTypeById(id);
    }
}
